package io.gps.datatransfer.task.taskentity;

import io.gps.datatransfer.utils.SysDef;
import org.apache.log4j.Logger;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;

public class SendDownMsgWork implements Runnable  {

    private static Logger logger = Logger.getLogger(SendDownMsgWork.class);
    String sim;
    IoBuffer msg;
    /**
     * 批量执行数据解析
     * @param sim
     */
    public SendDownMsgWork(String sim, IoBuffer msg) {
        this.sim = sim;
        this.msg=msg;
    }
    @Override
    public void run() {
        try {
            IoSession downSession= SysDef.sim_session.get(sim);
            if(downSession!=null&&msg!=null){
                downSession.write(msg);
            }
        } catch (Exception ie) {
            logger.error(" SendDownMsgWork ",ie);
        }
    }
}